using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableWarehouseHistory
	{
		public const string Table = "WarehouseHistory";
		public const string WarehouseHistoryID = "WarehouseHistoryID";
		public const string WarehouseID = "WarehouseID";
		public const string VegetablesID = "VegetablesID";
		public const string OriginalPrice = "OriginalPrice";
		public const string TotalQty = "TotalQty";
		public const string STotalQty = "STotalQty";
		public const string VegetablesName = "VegetablesName";
		public const string VegetablesNo = "VegetablesNo";
		public const string EnteringDate = "EnteringDate";
		public const string Creater = "Creater";
		public const string CreatedBy = "CreatedBy";
		public const string Created = "Created";
	}
	
	[Serializable]
	public class BaseWarehouseHistory
		: IDbSessionEntity, IJsonClass
	{
		int m_WarehouseHistoryID;
		/// <summary>
        /// 库存历史记录表ID
        /// </summary>
        public int WarehouseHistoryID
        {
            get { return m_WarehouseHistoryID; }
            set { m_WarehouseHistoryID = value; }
        }
		
		int? m_WarehouseID;
		/// <summary>
        /// 库存表ID
        /// </summary>
        public int? WarehouseID
        {
            get { return m_WarehouseID; }
            set { m_WarehouseID = value; }
        }
		
		int? m_VegetablesID;
		/// <summary>
        /// 蔬菜信息表ID
        /// </summary>
        public int? VegetablesID
        {
            get { return m_VegetablesID; }
            set { m_VegetablesID = value; }
        }
		
		double m_OriginalPrice;
		/// <summary>
        /// 原价
        /// </summary>
        public double OriginalPrice
        {
            get { return m_OriginalPrice; }
            set { m_OriginalPrice = value; }
        }
		
		double m_TotalQty;
		/// <summary>
        /// 当前数量
        /// </summary>
        public double TotalQty
        {
            get { return m_TotalQty; }
            set { m_TotalQty = value; }
        }
		
		double m_STotalQty;
		/// <summary>
        /// 入库时总数量
        /// </summary>
        public double STotalQty
        {
            get { return m_STotalQty; }
            set { m_STotalQty = value; }
        }
		
		string m_VegetablesName;
		/// <summary>
        /// 蔬菜名称
        /// </summary>
        public string VegetablesName
        {
            get { return m_VegetablesName; }
            set { m_VegetablesName = value; }
        }
		
		string m_VegetablesNo;
		/// <summary>
        /// 商品编号
        /// </summary>
        public string VegetablesNo
        {
            get { return m_VegetablesNo; }
            set { m_VegetablesNo = value; }
        }
		
		DateTime m_EnteringDate;
		/// <summary>
        /// 入库时间
        /// </summary>
        public DateTime EnteringDate
        {
            get { return m_EnteringDate; }
            set { m_EnteringDate = value; }
        }
		
		int m_Creater;
		/// <summary>
        /// 创建人ID
        /// </summary>
        public int Creater
        {
            get { return m_Creater; }
            set { m_Creater = value; }
        }
		
		string m_CreatedBy;
		/// <summary>
        /// 创建人名称
        /// </summary>
        public string CreatedBy
        {
            get { return m_CreatedBy; }
            set { m_CreatedBy = value; }
        }
		
		DateTime m_Created;
		/// <summary>
        /// 创建时间
        /// </summary>
        public DateTime Created
        {
            get { return m_Created; }
            set { m_Created = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_WarehouseHistoryID = reader[TableWarehouseHistory.WarehouseHistoryID];
            m_WarehouseID = reader[TableWarehouseHistory.WarehouseID];
            m_VegetablesID = reader[TableWarehouseHistory.VegetablesID];
            m_OriginalPrice = reader[TableWarehouseHistory.OriginalPrice];
            m_TotalQty = reader[TableWarehouseHistory.TotalQty];
            m_STotalQty = reader[TableWarehouseHistory.STotalQty];
            m_VegetablesName = reader[TableWarehouseHistory.VegetablesName];
            m_VegetablesNo = reader[TableWarehouseHistory.VegetablesNo];
            m_EnteringDate = reader[TableWarehouseHistory.EnteringDate];
            m_Creater = reader[TableWarehouseHistory.Creater];
            m_CreatedBy = reader[TableWarehouseHistory.CreatedBy];
            m_Created = reader[TableWarehouseHistory.Created];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableWarehouseHistory.WarehouseHistoryID, PrimaryKeyType.Identity, WarehouseHistoryID);
			writer[TableWarehouseHistory.WarehouseID] = WarehouseID;
			writer[TableWarehouseHistory.VegetablesID] = VegetablesID;
			writer[TableWarehouseHistory.OriginalPrice] = OriginalPrice;
			writer[TableWarehouseHistory.TotalQty] = TotalQty;
			writer[TableWarehouseHistory.STotalQty] = STotalQty;
			writer[TableWarehouseHistory.VegetablesName] = VegetablesName;
			writer[TableWarehouseHistory.VegetablesNo] = VegetablesNo;
			writer[TableWarehouseHistory.EnteringDate] = EnteringDate;
			writer[TableWarehouseHistory.Creater] = Creater;
			writer[TableWarehouseHistory.CreatedBy] = CreatedBy;
			writer[TableWarehouseHistory.Created] = Created;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_WarehouseHistoryID = idd;
        }
		
		public string TableName
        {
            get { return TableWarehouseHistory.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_WarehouseHistoryID = hashToRead["WarehouseHistoryID"];
			 
             m_WarehouseID = hashToRead["WarehouseID"];
			 
             m_VegetablesID = hashToRead["VegetablesID"];
			 
             m_OriginalPrice = hashToRead["OriginalPrice"];
			 
             m_TotalQty = hashToRead["TotalQty"];
			 
             m_STotalQty = hashToRead["STotalQty"];
			 
             m_VegetablesName = hashToRead["VegetablesName"];
			 
             m_VegetablesNo = hashToRead["VegetablesNo"];
			 
             m_EnteringDate = hashToRead["EnteringDate"];
			 
             m_Creater = hashToRead["Creater"];
			 
             m_CreatedBy = hashToRead["CreatedBy"];
			 
             m_Created = hashToRead["Created"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["WarehouseHistoryID"] = WarehouseHistoryID;
			 
            hashToFill["WarehouseID"] = WarehouseID;
			 
            hashToFill["VegetablesID"] = VegetablesID;
			 
            hashToFill["OriginalPrice"] = OriginalPrice;
			 
            hashToFill["TotalQty"] = TotalQty;
			 
            hashToFill["STotalQty"] = STotalQty;
			 
            hashToFill["VegetablesName"] = VegetablesName;
			 
            hashToFill["VegetablesNo"] = VegetablesNo;
			 
            hashToFill["EnteringDate"] = EnteringDate;
			 
            hashToFill["Creater"] = Creater;
			 
            hashToFill["CreatedBy"] = CreatedBy;
			 
            hashToFill["Created"] = Created;
			 
        }

        #endregion
		
	}
}
